<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html lang="en">

<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
  <title>LCOV - Lua 5.4.0-alpha - src/lfunc.c</title>
  <link rel="stylesheet" type="text/css" href="../gcov.css">
</head>

<body>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="title">LCOV - code coverage report</td></tr>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>

    <tr>
      <td width="100%">
        <table cellpadding=1 border=0 width="100%">
          <tr>
            <td width="10%" class="headerItem">Current view:</td>
            <td width="35%" class="headerValue"><a href="../index.html">top level</a> - <a href="index.html">src</a> - lfunc.c</td>
            <td width="5%"></td>
            <td width="15%"></td>
            <td width="10%" class="headerCovTableHead">Hit</td>
            <td width="10%" class="headerCovTableHead">Total</td>
            <td width="15%" class="headerCovTableHead">Coverage</td>
          </tr>
          <tr>
            <td class="headerItem">Test:</td>
            <td class="headerValue">Lua 5.4.0-alpha</td>
            <td></td>
            <td class="headerItem">Lines:</td>
            <td class="headerCovTableEntry">134</td>
            <td class="headerCovTableEntry">145</td>
            <td class="headerCovTableEntryHi">92.4 %</td>
          </tr>
          <tr>
            <td class="headerItem">Date:</td>
            <td class="headerValue">2019-06-13 19:44:19</td>
            <td></td>
          </tr>
          <tr>
            <td class="headerItem">Legend:</td>
            <td class="headerValueLeg">            Lines:
            <span class="coverLegendCov">hit</span>
            <span class="coverLegendNoCov">not hit</span>
</td>
            <td></td>
          </tr>
          <tr><td><img src="../glass.png" width=3 height=3 alt=""></td></tr>
        </table>
      </td>
    </tr>

    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
  </table>

  <table cellpadding=0 cellspacing=0 border=0>
    <tr>
      <td><br></td>
    </tr>
    <tr>
      <td>
<pre class="sourceHeading">          Line data    Source code</pre>
<pre class="source">
<span class="lineNum">       1 </span>            : /*
<span class="lineNum">       2 </span>            : ** $Id: lfunc.c $
<span class="lineNum">       3 </span>            : ** Auxiliary functions to manipulate prototypes and closures
<span class="lineNum">       4 </span>            : ** See Copyright Notice in lua.h
<span class="lineNum">       5 </span>            : */
<span class="lineNum">       6 </span>            : 
<span class="lineNum">       7 </span>            : #define lfunc_c
<span class="lineNum">       8 </span>            : #define LUA_CORE
<span class="lineNum">       9 </span>            : 
<span class="lineNum">      10 </span>            : #include &quot;lprefix.h&quot;
<span class="lineNum">      11 </span>            : 
<span class="lineNum">      12 </span>            : 
<span class="lineNum">      13 </span>            : #include &lt;stddef.h&gt;
<span class="lineNum">      14 </span>            : 
<span class="lineNum">      15 </span>            : #include &quot;lua.h&quot;
<span class="lineNum">      16 </span>            : 
<span class="lineNum">      17 </span>            : #include &quot;ldebug.h&quot;
<span class="lineNum">      18 </span>            : #include &quot;ldo.h&quot;
<span class="lineNum">      19 </span>            : #include &quot;lfunc.h&quot;
<span class="lineNum">      20 </span>            : #include &quot;lgc.h&quot;
<span class="lineNum">      21 </span>            : #include &quot;lmem.h&quot;
<span class="lineNum">      22 </span>            : #include &quot;lobject.h&quot;
<span class="lineNum">      23 </span>            : #include &quot;lstate.h&quot;
<span class="lineNum">      24 </span>            : 
<span class="lineNum">      25 </span>            : 
<span class="lineNum">      26 </span>            : 
<span class="lineNum">      27 </span><span class="lineCov">        643 : CClosure *luaF_newCclosure (lua_State *L, int n) {</span>
<span class="lineNum">      28 </span><span class="lineCov">        643 :   GCObject *o = luaC_newobj(L, LUA_TCCL, sizeCclosure(n));</span>
<span class="lineNum">      29 </span><span class="lineCov">        643 :   CClosure *c = gco2ccl(o);</span>
<span class="lineNum">      30 </span><span class="lineCov">        643 :   c-&gt;nupvalues = cast_byte(n);</span>
<span class="lineNum">      31 </span><span class="lineCov">        643 :   return c;</span>
<span class="lineNum">      32 </span>            : }
<span class="lineNum">      33 </span>            : 
<span class="lineNum">      34 </span>            : 
<span class="lineNum">      35 </span><span class="lineCov">       2924 : LClosure *luaF_newLclosure (lua_State *L, int n) {</span>
<span class="lineNum">      36 </span><span class="lineCov">       2924 :   GCObject *o = luaC_newobj(L, LUA_TLCL, sizeLclosure(n));</span>
<span class="lineNum">      37 </span><span class="lineCov">       2924 :   LClosure *c = gco2lcl(o);</span>
<span class="lineNum">      38 </span><span class="lineCov">       2924 :   c-&gt;p = NULL;</span>
<span class="lineNum">      39 </span><span class="lineCov">       2924 :   c-&gt;nupvalues = cast_byte(n);</span>
<span class="lineNum">      40 </span><span class="lineCov">      11384 :   while (n--) c-&gt;upvals[n] = NULL;</span>
<span class="lineNum">      41 </span><span class="lineCov">       2924 :   return c;</span>
<span class="lineNum">      42 </span>            : }
<span class="lineNum">      43 </span>            : 
<span class="lineNum">      44 </span>            : 
<span class="lineNum">      45 </span>            : /*
<span class="lineNum">      46 </span>            : ** fill a closure with new closed upvalues
<span class="lineNum">      47 </span>            : */
<span class="lineNum">      48 </span><span class="lineCov">        476 : void luaF_initupvals (lua_State *L, LClosure *cl) {</span>
<span class="lineNum">      49 </span>            :   int i;
<span class="lineNum">      50 </span><span class="lineCov">        952 :   for (i = 0; i &lt; cl-&gt;nupvalues; i++) {</span>
<span class="lineNum">      51 </span><span class="lineCov">        476 :     GCObject *o = luaC_newobj(L, LUA_TUPVAL, sizeof(UpVal));</span>
<span class="lineNum">      52 </span><span class="lineCov">        476 :     UpVal *uv = gco2upv(o);</span>
<span class="lineNum">      53 </span><span class="lineCov">        476 :     uv-&gt;v = &amp;uv-&gt;u.value;  /* make it closed */</span>
<span class="lineNum">      54 </span><span class="lineCov">        476 :     setnilvalue(uv-&gt;v);</span>
<span class="lineNum">      55 </span><span class="lineCov">        476 :     cl-&gt;upvals[i] = uv;</span>
<span class="lineNum">      56 </span><span class="lineCov">        476 :     luaC_objbarrier(L, cl, o);</span>
<span class="lineNum">      57 </span>            :   }
<span class="lineNum">      58 </span><span class="lineCov">        476 : }</span>
<span class="lineNum">      59 </span>            : 
<span class="lineNum">      60 </span>            : 
<span class="lineNum">      61 </span>            : /*
<span class="lineNum">      62 </span>            : ** Create a new upvalue with the given tag at the given level,
<span class="lineNum">      63 </span>            : ** and link it to the list of open upvalues of 'L' after entry 'prev'.
<span class="lineNum">      64 </span>            : **/
<span class="lineNum">      65 </span><span class="lineCov">       5259 : static UpVal *newupval (lua_State *L, int tag, StkId level, UpVal **prev) {</span>
<span class="lineNum">      66 </span><span class="lineCov">       5259 :   GCObject *o = luaC_newobj(L, tag, sizeof(UpVal));</span>
<span class="lineNum">      67 </span><span class="lineCov">       5259 :   UpVal *uv = gco2upv(o);</span>
<span class="lineNum">      68 </span><span class="lineCov">       5259 :   UpVal *next = *prev;</span>
<span class="lineNum">      69 </span><span class="lineCov">       5259 :   uv-&gt;v = s2v(level);  /* current value lives in the stack */</span>
<span class="lineNum">      70 </span><span class="lineCov">       5259 :   uv-&gt;u.open.next = next;  /* link it to list of open upvalues */</span>
<span class="lineNum">      71 </span><span class="lineCov">       5259 :   uv-&gt;u.open.previous = prev;</span>
<span class="lineNum">      72 </span><span class="lineCov">       5259 :   if (next)</span>
<span class="lineNum">      73 </span><span class="lineCov">       4701 :     next-&gt;u.open.previous = &amp;uv-&gt;u.open.next;</span>
<span class="lineNum">      74 </span><span class="lineCov">       5259 :   *prev = uv;</span>
<span class="lineNum">      75 </span><span class="lineCov">       5259 :   if (!isintwups(L)) {  /* thread not in list of threads with upvalues? */</span>
<span class="lineNum">      76 </span><span class="lineCov">         97 :     L-&gt;twups = G(L)-&gt;twups;  /* link it to the list */</span>
<span class="lineNum">      77 </span><span class="lineCov">         97 :     G(L)-&gt;twups = L;</span>
<span class="lineNum">      78 </span>            :   }
<span class="lineNum">      79 </span><span class="lineCov">       5259 :   return uv;</span>
<span class="lineNum">      80 </span>            : }
<span class="lineNum">      81 </span>            : 
<span class="lineNum">      82 </span>            : 
<span class="lineNum">      83 </span>            : /*
<span class="lineNum">      84 </span>            : ** Find and reuse, or create if it does not exist, a regular upvalue
<span class="lineNum">      85 </span>            : ** at the given level.
<span class="lineNum">      86 </span>            : */
<span class="lineNum">      87 </span><span class="lineCov">       6346 : UpVal *luaF_findupval (lua_State *L, StkId level) {</span>
<span class="lineNum">      88 </span><span class="lineCov">       6346 :   UpVal **pp = &amp;L-&gt;openupval;</span>
<span class="lineNum">      89 </span>            :   UpVal *p;
<span class="lineNum">      90 </span>            :   lua_assert(isintwups(L) || L-&gt;openupval == NULL);
<span class="lineNum">      91 </span><span class="lineCov">      14017 :   while ((p = *pp) != NULL &amp;&amp; uplevel(p) &gt;= level) {  /* search for it */</span>
<span class="lineNum">      92 </span><span class="lineCov">       8766 :     if (uplevel(p) == level &amp;&amp; !isdead(G(L), p))  /* corresponding upvalue? */</span>
<span class="lineNum">      93 </span><span class="lineCov">       1095 :       return p;  /* return it */</span>
<span class="lineNum">      94 </span><span class="lineCov">       7671 :     pp = &amp;p-&gt;u.open.next;</span>
<span class="lineNum">      95 </span>            :   }
<span class="lineNum">      96 </span>            :   /* not found: create a new upvalue after 'pp' */
<span class="lineNum">      97 </span><span class="lineCov">       5251 :   return newupval(L, LUA_TUPVAL, level, pp);</span>
<span class="lineNum">      98 </span>            : }
<span class="lineNum">      99 </span>            : 
<span class="lineNum">     100 </span>            : 
<span class="lineNum">     101 </span><span class="lineCov">          7 : static void callclose (lua_State *L, void *ud) {</span>
<span class="lineNum">     102 </span>            :   UNUSED(ud);
<span class="lineNum">     103 </span><span class="lineCov">          7 :   luaD_callnoyield(L, L-&gt;top - 3, 0);</span>
<span class="lineNum">     104 </span><span class="lineCov">          7 : }</span>
<span class="lineNum">     105 </span>            : 
<span class="lineNum">     106 </span>            : 
<span class="lineNum">     107 </span>            : /*
<span class="lineNum">     108 </span>            : ** Prepare closing method plus its arguments for object 'obj' with
<span class="lineNum">     109 </span>            : ** error message 'err'. (This function assumes EXTRA_STACK.)
<span class="lineNum">     110 </span>            : */
<span class="lineNum">     111 </span><span class="lineCov">          8 : static int prepclosingmethod (lua_State *L, TValue *obj, TValue *err) {</span>
<span class="lineNum">     112 </span><span class="lineCov">          8 :   StkId top = L-&gt;top;</span>
<span class="lineNum">     113 </span><span class="lineCov">          8 :   const TValue *tm = luaT_gettmbyobj(L, obj, TM_CLOSE);</span>
<span class="lineNum">     114 </span><span class="lineCov">          8 :   if (ttisnil(tm))  /* no metamethod? */</span>
<span class="lineNum">     115 </span><span class="lineCov">          1 :     return 0;  /* nothing to call */</span>
<span class="lineNum">     116 </span><span class="lineCov">          7 :   setobj2s(L, top, tm);  /* will call metamethod... */</span>
<span class="lineNum">     117 </span><span class="lineCov">          7 :   setobj2s(L, top + 1, obj);  /* with 'self' as the 1st argument */</span>
<span class="lineNum">     118 </span><span class="lineCov">          7 :   setobj2s(L, top + 2, err);  /* and error msg. as 2nd argument */</span>
<span class="lineNum">     119 </span><span class="lineCov">          7 :   L-&gt;top = top + 3;  /* add function and arguments */</span>
<span class="lineNum">     120 </span><span class="lineCov">          7 :   return 1;</span>
<span class="lineNum">     121 </span>            : }
<span class="lineNum">     122 </span>            : 
<span class="lineNum">     123 </span>            : 
<span class="lineNum">     124 </span>            : /*
<span class="lineNum">     125 </span>            : ** Prepare and call a closing method. If status is OK, code is still
<span class="lineNum">     126 </span>            : ** inside the original protected call, and so any error will be handled
<span class="lineNum">     127 </span>            : ** there. Otherwise, a previous error already activated original
<span class="lineNum">     128 </span>            : ** protected call, and so the call to the closing method must be
<span class="lineNum">     129 </span>            : ** protected here. (A status = CLOSEPROTECT behaves like a previous
<span class="lineNum">     130 </span>            : ** error, to also run the closing method in protected mode).
<span class="lineNum">     131 </span>            : ** If status is OK, the call to the closing method will be pushed
<span class="lineNum">     132 </span>            : ** at the top of the stack. Otherwise, values are pushed after
<span class="lineNum">     133 </span>            : ** the 'level' of the upvalue being closed, as everything after
<span class="lineNum">     134 </span>            : ** that won't be used again.
<span class="lineNum">     135 </span>            : */
<span class="lineNum">     136 </span><span class="lineCov">          8 : static int callclosemth (lua_State *L, TValue *uv, StkId level, int status) {</span>
<span class="lineNum">     137 </span><span class="lineCov">          8 :   if (likely(status == LUA_OK)) {</span>
<span class="lineNum">     138 </span><span class="lineCov">          8 :     if (prepclosingmethod(L, uv, &amp;G(L)-&gt;nilvalue))  /* something to call? */</span>
<span class="lineNum">     139 </span><span class="lineCov">          7 :       callclose(L, NULL);  /* call closing method */</span>
<span class="lineNum">     140 </span><span class="lineCov">          1 :     else if (!ttisnil(uv)) {  /* non-closable non-nil value? */</span>
<span class="lineNum">     141 </span><span class="lineCov">          1 :       int idx = cast_int(level - L-&gt;ci-&gt;func);</span>
<span class="lineNum">     142 </span><span class="lineCov">          1 :       const char *vname = luaG_findlocal(L, L-&gt;ci, idx, NULL);</span>
<span class="lineNum">     143 </span><span class="lineCov">          1 :       if (vname == NULL) vname = &quot;?&quot;;</span>
<span class="lineNum">     144 </span><span class="lineCov">          1 :       luaG_runerror(L, &quot;attempt to close non-closable variable '%s'&quot;, vname);</span>
<span class="lineNum">     145 </span>            :     }
<span class="lineNum">     146 </span>            :   }
<span class="lineNum">     147 </span>            :   else {  /* must close the object in protected mode */
<span class="lineNum">     148 </span><span class="lineNoCov">          0 :     ptrdiff_t oldtop = savestack(L, level + 1);</span>
<span class="lineNum">     149 </span>            :     /* save error message and set stack top to 'level + 1' */
<span class="lineNum">     150 </span><span class="lineNoCov">          0 :     luaD_seterrorobj(L, status, level);</span>
<span class="lineNum">     151 </span><span class="lineNoCov">          0 :     if (prepclosingmethod(L, uv, s2v(level))) {  /* something to call? */</span>
<span class="lineNum">     152 </span><span class="lineNoCov">          0 :       int newstatus = luaD_pcall(L, callclose, NULL, oldtop, 0);</span>
<span class="lineNum">     153 </span><span class="lineNoCov">          0 :       if (newstatus != LUA_OK &amp;&amp; status == CLOSEPROTECT)  /* first error? */</span>
<span class="lineNum">     154 </span><span class="lineNoCov">          0 :         status = newstatus;  /* this will be the new error */</span>
<span class="lineNum">     155 </span>            :       else  /* leave original error (or nil) on top */
<span class="lineNum">     156 </span><span class="lineNoCov">          0 :         L-&gt;top = restorestack(L, oldtop);</span>
<span class="lineNum">     157 </span>            :     }
<span class="lineNum">     158 </span>            :     /* else no metamethod; ignore this case and keep original error */
<span class="lineNum">     159 </span>            :   }
<span class="lineNum">     160 </span><span class="lineCov">          7 :   return status;</span>
<span class="lineNum">     161 </span>            : }
<span class="lineNum">     162 </span>            : 
<span class="lineNum">     163 </span>            : 
<span class="lineNum">     164 </span>            : /*
<span class="lineNum">     165 </span>            : ** Try to create a to-be-closed upvalue
<span class="lineNum">     166 </span>            : ** (can raise a memory-allocation error)
<span class="lineNum">     167 </span>            : */
<span class="lineNum">     168 </span><span class="lineCov">          8 : static void trynewtbcupval (lua_State *L, void *ud) {</span>
<span class="lineNum">     169 </span><span class="lineCov">          8 :   StkId level = cast(StkId, ud);</span>
<span class="lineNum">     170 </span>            :   lua_assert(L-&gt;openupval == NULL || uplevel(L-&gt;openupval) &lt; level);
<span class="lineNum">     171 </span><span class="lineCov">          8 :   newupval(L, LUA_TUPVALTBC, level, &amp;L-&gt;openupval);</span>
<span class="lineNum">     172 </span><span class="lineCov">          8 : }</span>
<span class="lineNum">     173 </span>            : 
<span class="lineNum">     174 </span>            : 
<span class="lineNum">     175 </span>            : /*
<span class="lineNum">     176 </span>            : ** Create a to-be-closed upvalue. If there is a memory error
<span class="lineNum">     177 </span>            : ** when creating the upvalue, the closing method must be called here,
<span class="lineNum">     178 </span>            : ** as there is no upvalue to call it later.
<span class="lineNum">     179 </span>            : */
<span class="lineNum">     180 </span><span class="lineCov">          8 : void luaF_newtbcupval (lua_State *L, StkId level) {</span>
<span class="lineNum">     181 </span><span class="lineCov">          8 :   int status = luaD_rawrunprotected(L, trynewtbcupval, level);</span>
<span class="lineNum">     182 </span><span class="lineCov">          8 :   if (unlikely(status != LUA_OK)) {  /* memory error creating upvalue? */</span>
<span class="lineNum">     183 </span>            :     lua_assert(status == LUA_ERRMEM);
<span class="lineNum">     184 </span><span class="lineNoCov">          0 :     luaD_seterrorobj(L, LUA_ERRMEM, level + 1);  /* save error message */</span>
<span class="lineNum">     185 </span><span class="lineNoCov">          0 :     if (prepclosingmethod(L, s2v(level), s2v(level + 1)))</span>
<span class="lineNum">     186 </span><span class="lineNoCov">          0 :       callclose(L, NULL);  /* call closing method */</span>
<span class="lineNum">     187 </span><span class="lineNoCov">          0 :     luaD_throw(L, LUA_ERRMEM);  /* throw memory error */</span>
<span class="lineNum">     188 </span>            :   }
<span class="lineNum">     189 </span><span class="lineCov">          8 : }</span>
<span class="lineNum">     190 </span>            : 
<span class="lineNum">     191 </span>            : 
<span class="lineNum">     192 </span><span class="lineCov">       5259 : void luaF_unlinkupval (UpVal *uv) {</span>
<span class="lineNum">     193 </span>            :   lua_assert(upisopen(uv));
<span class="lineNum">     194 </span><span class="lineCov">       5259 :   *uv-&gt;u.open.previous = uv-&gt;u.open.next;</span>
<span class="lineNum">     195 </span><span class="lineCov">       5259 :   if (uv-&gt;u.open.next)</span>
<span class="lineNum">     196 </span><span class="lineCov">       4960 :     uv-&gt;u.open.next-&gt;u.open.previous = uv-&gt;u.open.previous;</span>
<span class="lineNum">     197 </span><span class="lineCov">       5259 : }</span>
<span class="lineNum">     198 </span>            : 
<span class="lineNum">     199 </span>            : 
<span class="lineNum">     200 </span><span class="lineCov">     184002 : int luaF_close (lua_State *L, StkId level, int status) {</span>
<span class="lineNum">     201 </span>            :   UpVal *uv;
<span class="lineNum">     202 </span><span class="lineCov">     189255 :   while ((uv = L-&gt;openupval) != NULL &amp;&amp; uplevel(uv) &gt;= level) {</span>
<span class="lineNum">     203 </span><span class="lineCov">       5254 :     StkId upl = uplevel(uv);</span>
<span class="lineNum">     204 </span><span class="lineCov">       5254 :     TValue *slot = &amp;uv-&gt;u.value;  /* new position for value */</span>
<span class="lineNum">     205 </span><span class="lineCov">       5254 :     luaF_unlinkupval(uv);</span>
<span class="lineNum">     206 </span><span class="lineCov">       5254 :     setobj(L, slot, uv-&gt;v);  /* move value to upvalue slot */</span>
<span class="lineNum">     207 </span><span class="lineCov">       5254 :     uv-&gt;v = slot;  /* now current value lives here */</span>
<span class="lineNum">     208 </span><span class="lineCov">       5254 :     if (!iswhite(uv))</span>
<span class="lineNum">     209 </span><span class="lineCov">         36 :       gray2black(uv);  /* closed upvalues cannot be gray */</span>
<span class="lineNum">     210 </span><span class="lineCov">       5254 :     luaC_barrier(L, uv, slot);</span>
<span class="lineNum">     211 </span><span class="lineCov">       5254 :     if (uv-&gt;tt == LUA_TUPVALTBC &amp;&amp; status != NOCLOSINGMETH) {</span>
<span class="lineNum">     212 </span>            :       /* must run closing method */
<span class="lineNum">     213 </span><span class="lineCov">          8 :       ptrdiff_t levelrel = savestack(L, level);</span>
<span class="lineNum">     214 </span><span class="lineCov">          8 :       status = callclosemth(L, uv-&gt;v, upl, status);  /* may change the stack */</span>
<span class="lineNum">     215 </span><span class="lineCov">          7 :       level = restorestack(L, levelrel);</span>
<span class="lineNum">     216 </span>            :     }
<span class="lineNum">     217 </span>            :   }
<span class="lineNum">     218 </span><span class="lineCov">     184001 :   return status;</span>
<span class="lineNum">     219 </span>            : }
<span class="lineNum">     220 </span>            : 
<span class="lineNum">     221 </span>            : 
<span class="lineNum">     222 </span><span class="lineCov">       2086 : Proto *luaF_newproto (lua_State *L) {</span>
<span class="lineNum">     223 </span><span class="lineCov">       2086 :   GCObject *o = luaC_newobj(L, LUA_TPROTO, sizeof(Proto));</span>
<span class="lineNum">     224 </span><span class="lineCov">       2086 :   Proto *f = gco2p(o);</span>
<span class="lineNum">     225 </span><span class="lineCov">       2086 :   f-&gt;k = NULL;</span>
<span class="lineNum">     226 </span><span class="lineCov">       2086 :   f-&gt;sizek = 0;</span>
<span class="lineNum">     227 </span><span class="lineCov">       2086 :   f-&gt;p = NULL;</span>
<span class="lineNum">     228 </span><span class="lineCov">       2086 :   f-&gt;sizep = 0;</span>
<span class="lineNum">     229 </span><span class="lineCov">       2086 :   f-&gt;code = NULL;</span>
<span class="lineNum">     230 </span><span class="lineCov">       2086 :   f-&gt;sizecode = 0;</span>
<span class="lineNum">     231 </span><span class="lineCov">       2086 :   f-&gt;lineinfo = NULL;</span>
<span class="lineNum">     232 </span><span class="lineCov">       2086 :   f-&gt;sizelineinfo = 0;</span>
<span class="lineNum">     233 </span><span class="lineCov">       2086 :   f-&gt;abslineinfo = NULL;</span>
<span class="lineNum">     234 </span><span class="lineCov">       2086 :   f-&gt;sizeabslineinfo = 0;</span>
<span class="lineNum">     235 </span><span class="lineCov">       2086 :   f-&gt;upvalues = NULL;</span>
<span class="lineNum">     236 </span><span class="lineCov">       2086 :   f-&gt;sizeupvalues = 0;</span>
<span class="lineNum">     237 </span><span class="lineCov">       2086 :   f-&gt;numparams = 0;</span>
<span class="lineNum">     238 </span><span class="lineCov">       2086 :   f-&gt;is_vararg = 0;</span>
<span class="lineNum">     239 </span><span class="lineCov">       2086 :   f-&gt;maxstacksize = 0;</span>
<span class="lineNum">     240 </span><span class="lineCov">       2086 :   f-&gt;locvars = NULL;</span>
<span class="lineNum">     241 </span><span class="lineCov">       2086 :   f-&gt;sizelocvars = 0;</span>
<span class="lineNum">     242 </span><span class="lineCov">       2086 :   f-&gt;linedefined = 0;</span>
<span class="lineNum">     243 </span><span class="lineCov">       2086 :   f-&gt;lastlinedefined = 0;</span>
<span class="lineNum">     244 </span><span class="lineCov">       2086 :   f-&gt;source = NULL;</span>
<span class="lineNum">     245 </span><span class="lineCov">       2086 :   return f;</span>
<span class="lineNum">     246 </span>            : }
<span class="lineNum">     247 </span>            : 
<span class="lineNum">     248 </span>            : 
<span class="lineNum">     249 </span><span class="lineCov">       1965 : void luaF_freeproto (lua_State *L, Proto *f) {</span>
<span class="lineNum">     250 </span><span class="lineCov">       1965 :   luaM_freearray(L, f-&gt;code, f-&gt;sizecode);</span>
<span class="lineNum">     251 </span><span class="lineCov">       1965 :   luaM_freearray(L, f-&gt;p, f-&gt;sizep);</span>
<span class="lineNum">     252 </span><span class="lineCov">       1965 :   luaM_freearray(L, f-&gt;k, f-&gt;sizek);</span>
<span class="lineNum">     253 </span><span class="lineCov">       1965 :   luaM_freearray(L, f-&gt;lineinfo, f-&gt;sizelineinfo);</span>
<span class="lineNum">     254 </span><span class="lineCov">       1965 :   luaM_freearray(L, f-&gt;abslineinfo, f-&gt;sizeabslineinfo);</span>
<span class="lineNum">     255 </span><span class="lineCov">       1965 :   luaM_freearray(L, f-&gt;locvars, f-&gt;sizelocvars);</span>
<span class="lineNum">     256 </span><span class="lineCov">       1965 :   luaM_freearray(L, f-&gt;upvalues, f-&gt;sizeupvalues);</span>
<span class="lineNum">     257 </span><span class="lineCov">       1965 :   luaM_free(L, f);</span>
<span class="lineNum">     258 </span><span class="lineCov">       1965 : }</span>
<span class="lineNum">     259 </span>            : 
<span class="lineNum">     260 </span>            : 
<span class="lineNum">     261 </span>            : /*
<span class="lineNum">     262 </span>            : ** Look for n-th local variable at line 'line' in function 'func'.
<span class="lineNum">     263 </span>            : ** Returns NULL if not found.
<span class="lineNum">     264 </span>            : */
<span class="lineNum">     265 </span><span class="lineCov">        289 : const char *luaF_getlocalname (const Proto *f, int local_number, int pc) {</span>
<span class="lineNum">     266 </span>            :   int i;
<span class="lineNum">     267 </span><span class="lineCov">        326 :   for (i = 0; i&lt;f-&gt;sizelocvars &amp;&amp; f-&gt;locvars[i].startpc &lt;= pc; i++) {</span>
<span class="lineNum">     268 </span><span class="lineCov">         49 :     if (pc &lt; f-&gt;locvars[i].endpc) {  /* is variable active? */</span>
<span class="lineNum">     269 </span><span class="lineCov">         34 :       local_number--;</span>
<span class="lineNum">     270 </span><span class="lineCov">         34 :       if (local_number == 0)</span>
<span class="lineNum">     271 </span><span class="lineCov">         12 :         return getstr(f-&gt;locvars[i].varname);</span>
<span class="lineNum">     272 </span>            :     }
<span class="lineNum">     273 </span>            :   }
<span class="lineNum">     274 </span><span class="lineCov">        277 :   return NULL;  /* not found */</span>
<span class="lineNum">     275 </span>            : }
<span class="lineNum">     276 </span>            : 
</pre>
      </td>
    </tr>
  </table>
  <br>

  <table width="100%" border=0 cellspacing=0 cellpadding=0>
    <tr><td class="ruler"><img src="../glass.png" width=3 height=3 alt=""></td></tr>
    <tr><td class="versionInfo">Generated by: <a href="http://ltp.sourceforge.net/coverage/lcov.php" target="_parent">LCOV version 1.13</a></td></tr>
  </table>
  <br>

</body>
</html>
